<div class="col mb-4">
  <div class="card preview-card">
    <% if collection.remote? %>
      <div class='card-header position-absolute w-100 top-0 z-3 bg-body-secondary text-secondary-emphasis opacity-75'>
        <%= server_indicator collection %>
      </div>
    <% end %>
    <%= PreviewFrame(object: collection) %>
    <div class="card-body">
      <div class="row">
        <div class="col">
          <div class="card-title">
            <%= collection.name.careful_titleize %>
            <%= AccessIndicator object: collection %>
          </div>
          <% if collection.caption %>
            <span class="card-subtitle mb-2 text-muted"><%= sanitize collection.caption %></span>
          <% end %>
          <%= LinkList links: collection.links %>
        </div>
        <div class="col col-auto">
          <small>
            <%= render "attribution", collection: collection %>
          </small>
        </div>
      </div>
    </div>
    <div class='card-footer'>
      <div class='row'>
        <% model_count = policy_scope(collection.models).count %>
        <% collection_count = policy_scope(collection.collections).count %>
        <div class='col'>
          <%= if policy(collection).show?
                GoButton(
                  label: "#{model_count} #{Model.model_name.human count: model_count}",
                  aria_label: collection.remote? ?
                    translate(".models_button.remote_label", name: collection.name) :
                    translate(".models_button.label", name: collection.name),
                  href: collection_path(collection),
                  variant: "primary"
                )
              end %>
          <%= if policy(collection).show? && !collection.collections.empty?
                GoButton(
                  label: "#{collection_count} #{Collection.model_name.human count: collection_count}",
                  aria_label: collection.remote? ?
                    translate(".collections_button.remote_label", name: collection.name) :
                    translate(".collections_button.label", name: collection.name),
                  href: collections_path(collection: collection),
                  variant: "primary"
                )
              end %>
        </div>
        <div class='col col-auto'>
          <%= BurgerMenu do %>
            <%= DropdownItem(icon: "pencil", label: translate("general.edit"), path: edit_collection_path(collection), aria_label: translate(".edit_button.label", name: collection.name)) if policy(collection).edit? %>
            <%= DropdownItem(icon: "trash", label: translate("general.delete"), path: collection_path(collection), method: :delete, aria_label: translate(".delete_button.label", name: collection.name), confirm: t("collections.destroy.confirm")) if policy(collection).destroy? %>
            <%= DropdownItem(icon: "flag", label: translate("general.report", type: ""), path: new_collection_report_path(collection)) if SiteSettings.multiuser_enabled? %>
          <% end %>
        </div>
      </div>
    </div>
  </div>
</div>
